#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <unistd.h>
int main(){

  if(fork() == 0){
    //child
    execl("/usr/bin/ls", "ls", "-a", "-l", "-n", "-i", NULL);
    exit(1);
  }
  //parent
  waitpid(-1, NULL, 0);
  printf("wait success!\n");

  //printf("I am a process! pid : %d\n",getpid());
  //execl("/usr/bin/lssss","ls","-a","-l",NULL);//execl执行程序替换
  //exit(1);
  //printf("hahaha\n");
  //printf("hahaha\n");
  //printf("hahaha\n");

  //pid_t id = fork();
  //if(id == 0){
  //  printf("I am a process! pid : %d\n",getpid());
  //  sleep(5);

  //  execl("/usr/bin/ls","ls","-a","-l",NULL);//execl执行程序替换
  //  printf("hahahahahahhaha\n");
  //  printf("hahahahahahhaha\n");
  //  printf("hahahahahahhaha\n");
  //  printf("hahahahahahhaha\n");
  //  exit(0);
  //}
  //while(1){
  //  printf("I am a father!\n");
  //  sleep(1);
  //}
  //waitpid(id, NULL,0);
  //printf("wait success\n");
  //return 0;
}
